package gameMap;

import java.awt.event.ActionEvent;
import java.util.LinkedList;

import javax.swing.*;

/**
 * @author Logical Solution
 *
 */
public class Map extends JLayeredPane{
	
	
	//public JLayeredPane layeredPane;
	public JLabel mapLabel;
	public JLabel smallMapLabel;
	int charPos = 0;
	public ImageIcon imagesMap = new ImageIcon("src/mansionMap.png");
	public ImageIcon secondFloor = new ImageIcon("src/mansion2nd.png");
	
	public ImageIcon[] iM = new ImageIcon[12];
	public JLabel[] jM = new JLabel [12];
	public ImageIcon[] grayM = new ImageIcon[13];
	public JLabel[] grayLabel = new JLabel[13];

	LinkedList<Integer> rV = new LinkedList<Integer>();
	
	public Map()
	{
		rV.add(new Integer(0));
		//layeredPane = getLayeredPane();
		iM[0] = new ImageIcon("src/Layers/layer1.png");
		iM[1] = new ImageIcon("src/Layers/layer1.png");
		iM[2] = new ImageIcon("src/Layers/layer1.png");
		iM[3] = new ImageIcon("src/Layers/layer2.png");
		iM[4] = new ImageIcon("src/Layers/layer3.png");
		iM[5] = new ImageIcon("src/Layers/layer3.png");
		iM[6] = new ImageIcon("src/Layers/layer4.png");
		iM[7] = new ImageIcon("src/Layers/layer5.png");
		iM[8] = new ImageIcon("src/Layers/layer6.png");
		iM[9] = new ImageIcon("src/Layers/layer7.png");
		iM[10] = new ImageIcon("src/Layers/layer10.png");
		iM[11] = new ImageIcon("src/Layers/layer11.png");
		
//		grayM[0] = new ImageIcon("src/Layers/layer1.png");
//		grayM[1] = new ImageIcon("src/Layers/layer1.png");
//		grayM[2] = new ImageIcon("src/Layers/layer1.png");
		grayM[3] = new ImageIcon("src/Layers/unLayer1.png");
		grayM[4] = new ImageIcon("src/Layers/unLayer2.png");
		grayM[5] = new ImageIcon("src/Layers/unLayer2.png");
		grayM[6] = new ImageIcon("src/Layers/unLayer4.png");
		grayM[7] = new ImageIcon("src/Layers/unLayer5.png");
		grayM[8] = new ImageIcon("src/Layers/unLayer7.png");
		grayM[9] = new ImageIcon("src/Layers/unLayer8.png");
		grayM[10] = new ImageIcon("src/Layers/unLayer10.png");
		grayM[11] = new ImageIcon("src/Layers/unLayer11.png");
		grayM[12] = new ImageIcon("src/Layers/unLayer12.png");
		
		for(int i = 0; i < iM.length; i++){
			jM[i] = new JLabel(iM[i]);
			jM[i].setBounds(0,0,640,455);
			jM[i].setLocation(0,0);
		}
		for(int i = 3; i < grayM.length; i++){
			grayLabel[i] = new JLabel(grayM[i]);
			grayLabel[i].setBounds(0,0,640,455);
			grayLabel[i].setLocation(0,0);
		}
		mapLabel = new JLabel(imagesMap);
		smallMapLabel = new JLabel(secondFloor);
		mapLabel.setBounds(0,0,640,455);

		//firstButton.add(mapFirst);
		smallMapLabel.setBounds(0,0,160,167);
		smallMapLabel.setLocation(455,254);

		//mapPane.add(mapLabel, new Integer(0), 0);
		//mapLabel.setBounds(0,0,640,480);
		//mapLabel.getInputMap().put(KeyStroke.getKeyStroke("M"), "OPEN_MAP");
		//mapLabel.getActionMap().put("OPEN_MAP", new MapListener());
		add(mapLabel, new Integer(0));
		//add(mapFirst, new Integer(3));
		add(smallMapLabel, new Integer(3));
	}
	public void makeGray(){
		for(int i = 3; i < grayLabel.length; i++){
			add(grayLabel[i], new Integer(4));
		}
	}
	public void addToList(int roomValue){
		makeGray();
		rV.add(new Integer(roomValue));
		add(jM[roomValue], new Integer(4));
	}
	public ImageIcon showMap()
	{
		return imagesMap;
	}
	public int showCharPos()
	{
		return charPos;
	}
} 
